<template>
	<view>
		<!-- 是否设置币种弹窗 -->
		<view>
			<u-modal :showCancelButton="true" confirmText="确定" confirmColor="#333333" cancelColor="#333333"
				cancelText="取消" width="600rpx" :show="coinshow" @cancel="cancel()" @close="cancel()"
				@confirm="confirmcoin()" title="设置币种">
				<view class="w100">
					<view class="w100 ft16 gray3 tc">
						<text>请选择您想显示的币种</text>
					</view>
					<view class="align-center w100 justify-around " style="margin-top: 50rpx;">
						<view class="align-center" v-for="(item,index) in coinLists" :key="index"
							@click="selectCoin(index)">
							<image v-if="selectActive==index" src="../../static/images/login/select.png"
								mode="aspectFill" style="width: 34rpx;height: 34rpx;"></image>
							<image v-else src="../../static/images/login/noselect.png" mode="aspectFill"
								style="width: 34rpx;height: 34rpx;"></image>
							<view class="ml5 ft16 gray3"><text>{{item}}</text></view>
						</view>
					</view>
				</view>
			</u-modal>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				coinshow: true,
				selectActive: 0,
				coinLists: ['人民币', '美元']
			}
		},
		methods: {
			cancel() {
				this.coinshow = false
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			confirmcoin() {
				this.coinshow = false
				uni.setStorageSync('currency', this.selectActive)
				this.$store.commit("saveCurrency", this.selectActive)
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			selectCoin(index) {
				this.selectActive = index
				
			}
		}
	}
</script>

<style lang="scss">
	/deep/.u-modal__title {
		color: #333333;
	}
</style>